package com.everest.tribalapp;

import android.app.Activity;
import android.app.AlertDialog;
import android.app.AlertDialog.Builder;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.Window;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;

public class Desa_Form3 extends Activity implements OnClickListener
{

	private Button next;
	private Button prev;
private EditText desa_f3_ans_1a;
private EditText desa_f3_ans_1b;
private EditText desa_f3_ans_211;
private EditText desa_f3_ans_212;
private EditText desa_f3_ans_213;
private EditText desa_f3_ans_214;
private EditText desa_f3_ans_215;
private EditText desa_f3_ans_221;
private EditText desa_f3_ans_222;
private EditText desa_f3_ans_223;
private EditText desa_f3_ans_224;
private EditText desa_f3_ans_225;
private EditText desa_f3_ans_231;
private EditText desa_f3_ans_232;
private EditText desa_f3_ans_233;
private EditText desa_f3_ans_234;
private EditText desa_f3_ans_235;
private EditText desa_f3_ans_3;
private EditText desa_f3_ans_4;
private EditText desa_f3_ans_5a;
private EditText desa_f3_ans_5b;
private EditText desa_f3_ans_5c;
private EditText desa_f3_ans_5d;
private EditText desa_f3_ans_5e;
	private TextView desa_f3_qes_1a;
	private TextView desa_f3_qes_1b;
	private TextView desa_f3_qes_211;
	private TextView desa_f3_qes_212;
	private TextView desa_f3_qes_213;
	private TextView desa_f3_qes_214;
	private TextView desa_f3_qes_215;
	private TextView desa_f3_qes_221;
	private TextView desa_f3_qes_222;
	private TextView desa_f3_qes_223;
	private TextView desa_f3_qes_224;
	private TextView desa_f3_qes_225;
	private TextView desa_f3_qes_231;
	private TextView desa_f3_qes_232;
	private TextView desa_f3_qes_233;
	private TextView desa_f3_qes_234;
	private TextView desa_f3_qes_235;
	private TextView desa_f3_qes_5d;
	private TextView desa_f3_qes_5e;
	private TextView desa_f3_qes_5c;
	private TextView desa_f3_qes_5b;
	private TextView desa_f3_qes_5a;
	private TextView desa_f3_qes_3;
	private TextView desa_f3_qes_4;

	private String value="";
	private CharSequence[] MSG_VALUES_211={"Menerima dan ada","Menerima tapi hilang","Menerima tapi diambil kembali","Tidak menerima","Perangkat tidak ada"};
	private CharSequence[] MSG_VALUES_1a={"Ya","Tidak --> waancara berhenti di sini"};
	private CharSequence[] MSG_VALUES_213={"Baik dan difungsikan","Baik tapi tidak difungsikan","Rusak","Perangkat tidak ada"};
	private CharSequence[] MSG_VALUES_214={"Di warung, toko, atau pasar","Di kantor Desa/Kecamatan","Di rumah Kepala Desa / Kelurahan","Di rumah perangkat Desa / Kelurahan","Di rumah penduduk"};
	private CharSequence[] MSG_VALUES_3={"Ya","Tidak"};
	private CharSequence[] MSG_VALUES_5a={"Penyedia jasa tidak memasang perangkat","Sudah pernah terpasang, tetapi sudah dibongkar lagi Kapan dibongkarnya? (Bulan/Tahun)","Alasan tidak terpasang lainnya, Sebutkan"};
	private CharSequence[] MSG_VALUES_5c={"Perangkat tidak digunakan","Perangkat rusak","Alasan dibongkar lainnya, Sebutkan"};
	
	protected String value1="";
	@Override
	public void onBackPressed() {
	}

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		super.onCreate(savedInstanceState);
		Desa_Form3.this.requestWindowFeature(Window.FEATURE_NO_TITLE);
		setContentView(R.layout.desa_f3);
		next=(Button)findViewById(R.id.desa_f3_next);
		prev=(Button)findViewById(R.id.desa_f3_prev);
		desa_f3_qes_1a=(TextView)findViewById(R.id.desa_f3_qes_1a);
		desa_f3_qes_1b=(TextView)findViewById(R.id.desa_f3_qes_1b);
		desa_f3_qes_211=(TextView)findViewById(R.id.desa_f3_qes_211);
		desa_f3_qes_212=(TextView)findViewById(R.id.desa_f3_qes_212);
		desa_f3_qes_213=(TextView)findViewById(R.id.desa_f3_qes_213);
		desa_f3_qes_214=(TextView)findViewById(R.id.desa_f3_qes_214);
		desa_f3_qes_215=(TextView)findViewById(R.id.desa_f3_qes_215);
		desa_f3_qes_221=(TextView)findViewById(R.id.desa_f3_qes_221);
		desa_f3_qes_222=(TextView)findViewById(R.id.desa_f3_qes_222);
		desa_f3_qes_223=(TextView)findViewById(R.id.desa_f3_qes_223);
		desa_f3_qes_224=(TextView)findViewById(R.id.desa_f3_qes_224);
		desa_f3_qes_225=(TextView)findViewById(R.id.desa_f3_qes_225);
		desa_f3_qes_231=(TextView)findViewById(R.id.desa_f3_qes_231);
		desa_f3_qes_232=(TextView)findViewById(R.id.desa_f3_qes_232);
		desa_f3_qes_233=(TextView)findViewById(R.id.desa_f3_qes_233);
		desa_f3_qes_234=(TextView)findViewById(R.id.desa_f3_qes_234);
		desa_f3_qes_235=(TextView)findViewById(R.id.desa_f3_qes_235);
		desa_f3_qes_3=(TextView)findViewById(R.id.desa_f3_qes_3);
		desa_f3_qes_4=(TextView)findViewById(R.id.desa_f3_qes_4);
		desa_f3_qes_5a=(TextView)findViewById(R.id.desa_f3_qes_5a);
		desa_f3_qes_5b=(TextView)findViewById(R.id.desa_f3_qes_5b);
		desa_f3_qes_5c=(TextView)findViewById(R.id.desa_f3_qes_5c);
		desa_f3_qes_5d=(TextView)findViewById(R.id.desa_f3_qes_5d);
		desa_f3_qes_5e=(TextView)findViewById(R.id.desa_f3_qes_5e);
		desa_f3_ans_1a=(EditText)findViewById(R.id.desa_f3_ans_1a);
		desa_f3_ans_1b=(EditText)findViewById(R.id.desa_f3_ans_1b);
		desa_f3_ans_211=(EditText)findViewById(R.id.desa_f3_ans_211);
		desa_f3_ans_212=(EditText)findViewById(R.id.desa_f3_ans_212);
		desa_f3_ans_213=(EditText)findViewById(R.id.desa_f3_ans_213);
		desa_f3_ans_214=(EditText)findViewById(R.id.desa_f3_ans_214);
		desa_f3_ans_215=(EditText)findViewById(R.id.desa_f3_ans_215);
		desa_f3_ans_221=(EditText)findViewById(R.id.desa_f3_ans_221);
		desa_f3_ans_222=(EditText)findViewById(R.id.desa_f3_ans_222);
		desa_f3_ans_223=(EditText)findViewById(R.id.desa_f3_ans_223);
		desa_f3_ans_224=(EditText)findViewById(R.id.desa_f3_ans_224);
		desa_f3_ans_225=(EditText)findViewById(R.id.desa_f3_ans_225);
		desa_f3_ans_231=(EditText)findViewById(R.id.desa_f3_ans_231);
		desa_f3_ans_232=(EditText)findViewById(R.id.desa_f3_ans_232);
		desa_f3_ans_233=(EditText)findViewById(R.id.desa_f3_ans_233);
		desa_f3_ans_234=(EditText)findViewById(R.id.desa_f3_ans_234);
		desa_f3_ans_235=(EditText)findViewById(R.id.desa_f3_ans_235);
		desa_f3_ans_3=(EditText)findViewById(R.id.desa_f3_ans_3);
		desa_f3_ans_4=(EditText)findViewById(R.id.desa_f3_ans_4);
		desa_f3_ans_5a=(EditText)findViewById(R.id.desa_f3_ans_5a);
		desa_f3_ans_5b=(EditText)findViewById(R.id.desa_f3_ans_5b);
		desa_f3_ans_5c=(EditText)findViewById(R.id.desa_f3_ans_5c);
		desa_f3_ans_5d=(EditText)findViewById(R.id.desa_f3_ans_5d);
		desa_f3_ans_5e=(EditText)findViewById(R.id.desa_f3_ans_5e);
		desa_f3_ans_1a.setFocusable(false);
		desa_f3_ans_211.setFocusable(false);
		desa_f3_ans_213.setFocusable(false);
		desa_f3_ans_214.setFocusable(false);
		desa_f3_ans_221.setFocusable(false);
		desa_f3_ans_223.setFocusable(false);
		desa_f3_ans_224.setFocusable(false);
		desa_f3_ans_231.setFocusable(false);
		desa_f3_ans_233.setFocusable(false);
		desa_f3_ans_234.setFocusable(false);
		desa_f3_ans_3.setFocusable(false);
		desa_f3_ans_5a.setFocusable(false);
		desa_f3_ans_5c.setFocusable(false);
		desa_f3_qes_1a.setOnClickListener(this);
		desa_f3_qes_1b.setOnClickListener(this);
		desa_f3_qes_211.setOnClickListener(this);
		desa_f3_qes_212.setOnClickListener(this);
		desa_f3_qes_213.setOnClickListener(this);
		desa_f3_qes_214.setOnClickListener(this);
		desa_f3_qes_215.setOnClickListener(this);
		desa_f3_qes_221.setOnClickListener(this);
		desa_f3_qes_222.setOnClickListener(this);
		desa_f3_qes_223.setOnClickListener(this);
		desa_f3_qes_224.setOnClickListener(this);
		desa_f3_qes_225.setOnClickListener(this);
		desa_f3_qes_231.setOnClickListener(this);
		desa_f3_qes_232.setOnClickListener(this);
		desa_f3_qes_233.setOnClickListener(this);
		desa_f3_qes_234.setOnClickListener(this);
		desa_f3_qes_235.setOnClickListener(this);
		desa_f3_qes_3.setOnClickListener(this);
		desa_f3_qes_4.setOnClickListener(this);
		desa_f3_qes_5a.setOnClickListener(this);
		desa_f3_qes_5b.setOnClickListener(this);
		desa_f3_qes_5c.setOnClickListener(this);
		desa_f3_qes_5d.setOnClickListener(this);
		desa_f3_qes_5e.setOnClickListener(this);
		desa_f3_ans_1a.setOnClickListener(this);
		desa_f3_ans_1b.setOnClickListener(this);
		desa_f3_ans_211.setOnClickListener(this);
		desa_f3_ans_212.setOnClickListener(this);
		desa_f3_ans_213.setOnClickListener(this);
		desa_f3_ans_214.setOnClickListener(this);
		desa_f3_ans_215.setOnClickListener(this);
		desa_f3_ans_221.setOnClickListener(this);
		desa_f3_ans_222.setOnClickListener(this);
		desa_f3_ans_223.setOnClickListener(this);
		desa_f3_ans_224.setOnClickListener(this);
		desa_f3_ans_225.setOnClickListener(this);
		desa_f3_ans_231.setOnClickListener(this);
		desa_f3_ans_232.setOnClickListener(this);
		desa_f3_ans_233.setOnClickListener(this);
		desa_f3_ans_234.setOnClickListener(this);
		desa_f3_ans_235.setOnClickListener(this);
		desa_f3_ans_3.setOnClickListener(this);
		desa_f3_ans_4.setOnClickListener(this);
		desa_f3_ans_5a.setOnClickListener(this);
		desa_f3_ans_5b.setOnClickListener(this);
		desa_f3_ans_5c.setOnClickListener(this);
		desa_f3_ans_5d.setOnClickListener(this);
		desa_f3_ans_5e.setOnClickListener(this);
		
		
		
		next.setOnClickListener(new OnClickListener() {
			
			@Override
			public void onClick(View v) {
				Intent intent=new Intent(getApplicationContext(),Desa_Form4.class);
				startActivity(intent);
				Desa_Form3.this.finish();
				
			}
		});
		prev.setOnClickListener(new OnClickListener() {
			
			@Override
			public void onClick(View v) {
				Intent intent=new Intent(getApplicationContext(),Desa_Form2.class);
				startActivity(intent);
				Desa_Form3.this.finish();
				
			}
		});
	}
	public void toast_msg()
	{
		LayoutInflater inflater = getLayoutInflater();

		View layout = inflater.inflate(R.layout.custom_toast,
				(ViewGroup) findViewById(R.id.custom_toast_layout_id));
		TextView text = (TextView) layout.findViewById(R.id.text);
		text.setText(value);
		Toast toast = new Toast(getApplicationContext());
		toast.setGravity(Gravity.CENTER_VERTICAL, 0, 0);
		toast.setDuration(Toast.LENGTH_LONG);
		toast.setView(layout);
		toast.show();
	}

	@Override
	public void onClick(View v)
	{
		
		if(v.getId()==desa_f3_qes_1a.getId())
		{
			value=getResources().getString(R.string.pinter_q3_1a);
			toast_msg();
		}
		else if(v.getId()==desa_f3_qes_1b.getId())
		{
			value=getResources().getString(R.string.pinter_q3_1b);
			toast_msg();
		}
		else if(v.getId()==desa_f3_qes_211.getId())
		{
			value=getResources().getString(R.string.pinter_q3_211);
			toast_msg();
		}
		else if(v.getId()==desa_f3_qes_212.getId())
		{
			value=getResources().getString(R.string.pinter_q3_212);
			toast_msg();
		}
		else if(v.getId()==desa_f3_qes_213.getId())
		{
			value=getResources().getString(R.string.pinter_q3_213);
			toast_msg();
		}
		else if(v.getId()==desa_f3_qes_214.getId())
		{
			value=getResources().getString(R.string.pinter_q3_214);
			toast_msg();
		}
		else if(v.getId()==desa_f3_qes_215.getId())
		{
			value=getResources().getString(R.string.pinter_q3_215);
			toast_msg();
		}
		else if(v.getId()==desa_f3_qes_221.getId())
		{
			value=getResources().getString(R.string.pinter_q3_221);
			toast_msg();
		}
		else if(v.getId()==desa_f3_qes_222.getId())
		{
			value=getResources().getString(R.string.pinter_q3_222);
			toast_msg();
		}
		else if(v.getId()==desa_f3_qes_223.getId())
		{
			value=getResources().getString(R.string.pinter_q3_223);
			toast_msg();
		}
		else if(v.getId()==desa_f3_qes_224.getId())
		{
			value=getResources().getString(R.string.pinter_q3_224);
			toast_msg();
		}
		else if(v.getId()==desa_f3_qes_225.getId())
		{
			value=getResources().getString(R.string.pinter_q3_225);
			toast_msg();
		}
		else if(v.getId()==desa_f3_qes_231.getId())
		{
			value=getResources().getString(R.string.pinter_q3_231);
			toast_msg();
		}
		else if(v.getId()==desa_f3_qes_232.getId())
		{
			value=getResources().getString(R.string.pinter_q3_232);
			toast_msg();
		}
		else if(v.getId()==desa_f3_qes_233.getId())
		{
			value=getResources().getString(R.string.pinter_q3_233);
			toast_msg();
		}
		else if(v.getId()==desa_f3_qes_234.getId())
		{
			value=getResources().getString(R.string.pinter_q3_234);
			toast_msg();
		}
		else if(v.getId()==desa_f3_qes_235.getId())
		{
			value=getResources().getString(R.string.pinter_q3_235);
			toast_msg();
		}
		else if(v.getId()==desa_f3_qes_3.getId())
		{
			value=getResources().getString(R.string.pinter_q3_3);
			toast_msg();
		}
		else if(v.getId()==desa_f3_qes_4.getId())
		{
			value=getResources().getString(R.string.pinter_q3_4);
			toast_msg();
		}
		else if(v.getId()==desa_f3_qes_5a.getId())
		{
			value=getResources().getString(R.string.pinter_q3_5);
			toast_msg();
		}
		else if(v.getId()==desa_f3_qes_5b.getId())
		{
			value=getResources().getString(R.string.pinter_q3_5a21);
			toast_msg();
		}
		else if(v.getId()==desa_f3_qes_5c.getId())
		{
			value=getResources().getString(R.string.pinter_q3_5a22a);
			toast_msg();
		}
		else if(v.getId()==desa_f3_qes_5d.getId())
		{
			value=getResources().getString(R.string.pinter_q3_5a22b);
			toast_msg();
		}
		else if(v.getId()==desa_f3_qes_5e.getId())
		{
			value=getResources().getString(R.string.pinter_q3_5b);
			toast_msg();
		}
		else if(v.getId()==desa_f3_ans_1a.getId())
		{
			msg_f3_ans_1a();
		}
		else if(v.getId()==desa_f3_ans_211.getId())
		{
			msg_f3_ans_211();
			
		}
		else if(v.getId()==desa_f3_ans_213.getId())
		{
			msg_f3_ans_213();
			
		}
		else if(v.getId()==desa_f3_ans_214.getId())
		{
			msg_f3_ans_214();
			
		}
		else if(v.getId()==desa_f3_ans_221.getId())
		{
			msg_f3_ans_221();
			
		}
		else if(v.getId()==desa_f3_ans_223.getId())
		{
			msg_f3_ans_223();
			
		}
		else if(v.getId()==desa_f3_ans_224.getId())
		{
			msg_f3_ans_224();
			
		}
		else if(v.getId()==desa_f3_ans_231.getId())
		{
			msg_f3_ans_231();
			
		}
		else if(v.getId()==desa_f3_ans_233.getId())
		{
			msg_f3_ans_233();
			
		}
		else if(v.getId()==desa_f3_ans_234.getId())
		{
			msg_f3_ans_234();
			
		}
		else if(v.getId()==desa_f3_ans_5a.getId())
		{
			msg_f3_ans_5a();
			
		}
		else if(v.getId()==desa_f3_ans_5c.getId())
		{
			msg_f3_ans_5c();
			
		}
		else if(v.getId()==desa_f3_ans_3.getId())
		{
			msg_f3_ans_3();
			
		}
		
	}
	private void msg_f3_ans_1a() {
	     Builder builder = new AlertDialog.Builder(this);
	     builder.setTitle("Select");
	     builder.setSingleChoiceItems(MSG_VALUES_1a, -1, new DialogInterface.OnClickListener() {
	       

		@Override
	       public void onClick(DialogInterface dialog, int which) {
			 desa_f3_ans_1a.setText(""+(which+1));
	         dialog.dismiss();
	         
	       }
	     });
	     builder.setNegativeButton("cancel",
	         new DialogInterface.OnClickListener() {
	           @Override
	           public void onClick(DialogInterface dialog, int which) {
	             dialog.dismiss();
	           }
	         });
	     AlertDialog alert = builder.create();
	     alert.show();
	   }
	private void msg_f3_ans_211() {
	     Builder builder = new AlertDialog.Builder(this);
	     builder.setTitle("Select");
	    //setSingleChoiceItems(MSG_VALUES_211, -1, listener)
	     builder.setSingleChoiceItems(MSG_VALUES_211, -1, new DialogInterface.OnClickListener() {
	       

		@Override
	       public void onClick(DialogInterface dialog, int which) 
		{
			 if(which==0){
				 desa_f3_ans_211.setText("11");
			 }
			 else if(which==1){
				 desa_f3_ans_211.setText("12");
			 }
			 else if(which==2){
				 desa_f3_ans_211.setText("13");
			 }
			 else if(which==3){
				 desa_f3_ans_211.setText("21");
			 }
			 else if(which==4){
				 desa_f3_ans_211.setText("22");
			 }
			
	         dialog.dismiss();
	         
	       }
	     });
	     builder.setNegativeButton("cancel",
	         new DialogInterface.OnClickListener() {
	           @Override
	           public void onClick(DialogInterface dialog, int which) {
	             dialog.dismiss();
	           }
	         });
	     AlertDialog alert = builder.create();
	     alert.show();
	   }
	private void msg_f3_ans_214() {
	     Builder builder = new AlertDialog.Builder(this);
	     builder.setTitle("Select");
	     builder.setSingleChoiceItems(MSG_VALUES_214, -1, new DialogInterface.OnClickListener() {
	       

	    	 @Override
		       public void onClick(DialogInterface dialog, int which) {
				if(which==0){

					desa_f3_ans_224.setText("31");
				 }
				 else if(which==1){

					 desa_f3_ans_224.setText("32");
				 }
				 else if(which==2){

					 desa_f3_ans_224.setText("33");
				 }
				 else if(which==3){

					 desa_f3_ans_224.setText("34");
				 }
				 else if(which==4){

					 desa_f3_ans_224.setText("35");
				 }
		         dialog.dismiss();
		         
		       }
	     });
	     builder.setNegativeButton("cancel",
	         new DialogInterface.OnClickListener() {
	           @Override
	           public void onClick(DialogInterface dialog, int which) {
	             dialog.dismiss();
	           }
	         });
	     AlertDialog alert = builder.create();
	     alert.show();
	   }
	private void msg_f3_ans_213() {
	     Builder builder = new AlertDialog.Builder(this);
	     builder.setTitle("Select");
	     builder.setSingleChoiceItems(MSG_VALUES_213, -1, new DialogInterface.OnClickListener() {
	       

		@Override
	       public void onClick(DialogInterface dialog, int which) {
			if(which==0){

				 desa_f3_ans_213.setText("21");
			 }
			 else if(which==1){

				 desa_f3_ans_213.setText("22");
			 }
			 else if(which==2){

				 desa_f3_ans_213.setText("23");
			 }
			 else if(which==3){

				 desa_f3_ans_213.setText("24");
			 }
	         dialog.dismiss();
	         
	       }
	     });
	     builder.setNegativeButton("cancel",
	         new DialogInterface.OnClickListener() {
	           @Override
	           public void onClick(DialogInterface dialog, int which) {
	             dialog.dismiss();
	           }
	         });
	     AlertDialog alert = builder.create();
	     alert.show();
	   }
	private void msg_f3_ans_221() {
	     Builder builder = new AlertDialog.Builder(this);
	     builder.setTitle("Select");
	     builder.setSingleChoiceItems(MSG_VALUES_211, -1, new DialogInterface.OnClickListener() {
	       

		@Override
	       public void onClick(DialogInterface dialog, int which) {
			if(which==0){
				 desa_f3_ans_221.setText("11");
			 }
			 else if(which==1){
				 desa_f3_ans_221.setText("12");
			 }
			 else if(which==2){
				 desa_f3_ans_221.setText("13");
			 }
			 else if(which==3){
				 desa_f3_ans_221.setText("21");
			 }
			 else if(which==4){
				 desa_f3_ans_221.setText("22");
			 }
	         dialog.dismiss();
	         
	       }
	     });
	     builder.setNegativeButton("cancel",
	         new DialogInterface.OnClickListener() {
	           @Override
	           public void onClick(DialogInterface dialog, int which) {
	             dialog.dismiss();
	           }
	         });
	     AlertDialog alert = builder.create();
	     alert.show();
	   }
	private void msg_f3_ans_223() {
	     Builder builder = new AlertDialog.Builder(this);
	     builder.setTitle("Select");
	     builder.setSingleChoiceItems(MSG_VALUES_213, -1, new DialogInterface.OnClickListener() {
	       

		@Override
	       public void onClick(DialogInterface dialog, int which) {
			if(which==0){

				 desa_f3_ans_223.setText("21");
			 }
			 else if(which==1){

				 desa_f3_ans_223.setText("22");
			 }
			 else if(which==2){

				 desa_f3_ans_223.setText("23");
			 }
			 else if(which==3){

				 desa_f3_ans_223.setText("24");
			 }
	         dialog.dismiss();
	         
	       }
	     });
	     builder.setNegativeButton("cancel",
	         new DialogInterface.OnClickListener() {
	           @Override
	           public void onClick(DialogInterface dialog, int which) {
	             dialog.dismiss();
	           }
	         });
	     AlertDialog alert = builder.create();
	     alert.show();
	   }
	private void msg_f3_ans_224() {
	     Builder builder = new AlertDialog.Builder(this);
	     builder.setTitle("Select");
	     builder.setSingleChoiceItems(MSG_VALUES_214, -1, new DialogInterface.OnClickListener() {
	       

		 
			@Override
		       public void onClick(DialogInterface dialog, int which) {
				if(which==0){
	
					desa_f3_ans_224.setText("31");
				 }
				 else if(which==1){
	
					 desa_f3_ans_224.setText("32");
				 }
				 else if(which==2){
	
					 desa_f3_ans_224.setText("33");
				 }
				 else if(which==3){
	
					 desa_f3_ans_224.setText("34");
				 }
				 else if(which==4){
	
					 desa_f3_ans_224.setText("35");
				 }
		         dialog.dismiss();
		         
		       }
	     });
	     builder.setNegativeButton("cancel",
	         new DialogInterface.OnClickListener() {
	           @Override
	           public void onClick(DialogInterface dialog, int which) {
	             dialog.dismiss();
	           }
	         });
	     AlertDialog alert = builder.create();
	     alert.show();
	   }
	private void msg_f3_ans_231() {
	     Builder builder = new AlertDialog.Builder(this);
	     builder.setTitle("Select");
	     builder.setSingleChoiceItems(MSG_VALUES_211, -1, new DialogInterface.OnClickListener() {
	       

		@Override
	       public void onClick(DialogInterface dialog, int which) {
			if(which==0){
				 desa_f3_ans_231.setText("11");
			 }
			 else if(which==1){
				 desa_f3_ans_231.setText("12");
			 }
			 else if(which==2){
				 desa_f3_ans_231.setText("13");
			 }
			 else if(which==3){
				 desa_f3_ans_231.setText("21");
			 }
			 else if(which==4){
				 desa_f3_ans_231.setText("22");
			 }
	         dialog.dismiss();
	         
	       }
	     });
	     builder.setNegativeButton("cancel",
	         new DialogInterface.OnClickListener() {
	           @Override
	           public void onClick(DialogInterface dialog, int which) {
	             dialog.dismiss();
	           }
	         });
	     AlertDialog alert = builder.create();
	     alert.show();
	   }
	private void msg_f3_ans_233() {
	     Builder builder = new AlertDialog.Builder(this);
	     builder.setTitle("Select");
	     builder.setSingleChoiceItems(MSG_VALUES_213, -1, new DialogInterface.OnClickListener() {
	       

		@Override
	       public void onClick(DialogInterface dialog, int which) {
			if(which==0){

				 desa_f3_ans_233.setText("21");
			 }
			 else if(which==1){

				 desa_f3_ans_233.setText("22");
			 }
			 else if(which==2){

				 desa_f3_ans_233.setText("23");
			 }
			 else if(which==3){

				 desa_f3_ans_233.setText("24");
			 }
	         dialog.dismiss();
	         
	       }
	     });
	     builder.setNegativeButton("cancel",
	         new DialogInterface.OnClickListener() {
	           @Override
	           public void onClick(DialogInterface dialog, int which) {
	             dialog.dismiss();
	           }
	         });
	     AlertDialog alert = builder.create();
	     alert.show();
	   }
	private void msg_f3_ans_234() {
	     Builder builder = new AlertDialog.Builder(this);
	     builder.setTitle("Select");
	     builder.setSingleChoiceItems(MSG_VALUES_214, -1, new DialogInterface.OnClickListener() {
	       

	    	 @Override
		       public void onClick(DialogInterface dialog, int which) {
				if(which==0){

					desa_f3_ans_224.setText("31");
				 }
				 else if(which==1){

					 desa_f3_ans_224.setText("32");
				 }
				 else if(which==2){

					 desa_f3_ans_224.setText("33");
				 }
				 else if(which==3){

					 desa_f3_ans_224.setText("34");
				 }
				 else if(which==4){

					 desa_f3_ans_224.setText("35");
				 }
		         dialog.dismiss();
		         
		       }
	     });
	     builder.setNegativeButton("cancel",
	         new DialogInterface.OnClickListener() {
	           @Override
	           public void onClick(DialogInterface dialog, int which) {
	             dialog.dismiss();
	           }
	         });
	     AlertDialog alert = builder.create();
	     alert.show();
	   }
	private void msg_f3_ans_3() {
	     Builder builder = new AlertDialog.Builder(this);
	     builder.setTitle("Select");
	     builder.setSingleChoiceItems(MSG_VALUES_3, -1, new DialogInterface.OnClickListener() {
	       

		@Override
	       public void onClick(DialogInterface dialog, int which) {
			 desa_f3_ans_3.setText(""+(which+1));
	         dialog.dismiss();
	         
	       }
	     });
	     builder.setNegativeButton("cancel",
	         new DialogInterface.OnClickListener() {
	           @Override
	           public void onClick(DialogInterface dialog, int which) {
	             dialog.dismiss();
	           }
	         });
	     AlertDialog alert = builder.create();
	     alert.show();
	   }
	private void msg_f3_ans_5a() {
	     Builder builder = new AlertDialog.Builder(this);
	     builder.setTitle("Select");
	     builder.setSingleChoiceItems(MSG_VALUES_5a, -1, new DialogInterface.OnClickListener() {
	       

		@Override
	       public void onClick(DialogInterface dialog, int which) {
			 desa_f3_ans_5a.setText(""+(which+1));
	         dialog.dismiss();
	         
	       }
	     });
	     builder.setNegativeButton("cancel",
	         new DialogInterface.OnClickListener() {
	           @Override
	           public void onClick(DialogInterface dialog, int which) {
	             dialog.dismiss();
	           }
	         });
	     AlertDialog alert = builder.create();
	     alert.show();
	   }
	private void msg_f3_ans_5c() {
	     Builder builder = new AlertDialog.Builder(this);
	     builder.setTitle("Select");
	     builder.setSingleChoiceItems(MSG_VALUES_5c, -1,new DialogInterface.OnClickListener() {
	       

		@Override
	       public void onClick(DialogInterface dialog, int which) {
			 desa_f3_ans_5c.setText(""+(which+1));
	         dialog.dismiss();
	         
	       }
	     });
	     builder.setNegativeButton("cancel",
	         new DialogInterface.OnClickListener() {
	           @Override
	           public void onClick(DialogInterface dialog, int which) {
	             dialog.dismiss();
	           }
	         });
	     AlertDialog alert = builder.create();
	     alert.show();
	   }

	@Override
	protected void onPause() {
		// TODO Auto-generated method stub
		super.onPause();
		SharedPreferences preferences=getSharedPreferences("desa_f3_details", MODE_PRIVATE);
		SharedPreferences.Editor editor=preferences.edit();
		editor.putString("3_1a",desa_f3_ans_1a.getText().toString().trim());
		editor.putString("3_1b",desa_f3_ans_1b.getText().toString().trim());
		editor.putString("3_211",desa_f3_ans_211.getText().toString().trim());
		editor.putString("3_212",desa_f3_ans_212.getText().toString().trim());
		editor.putString("3_213",desa_f3_ans_213.getText().toString().trim());
		editor.putString("3_214",desa_f3_ans_214.getText().toString().trim());
		editor.putString("3_215",desa_f3_ans_215.getText().toString().trim());
		editor.putString("3_221",desa_f3_ans_221.getText().toString().trim());
		editor.putString("3_222",desa_f3_ans_222.getText().toString().trim());
		editor.putString("3_223",desa_f3_ans_223.getText().toString().trim());
		editor.putString("3_224",desa_f3_ans_224.getText().toString().trim());
		editor.putString("3_225",desa_f3_ans_225.getText().toString().trim());
		editor.putString("3_231",desa_f3_ans_231.getText().toString().trim());
		editor.putString("3_232",desa_f3_ans_232.getText().toString().trim());
		editor.putString("3_233",desa_f3_ans_233.getText().toString().trim());
		editor.putString("3_234",desa_f3_ans_234.getText().toString().trim());
		editor.putString("3_235",desa_f3_ans_235.getText().toString().trim());
		editor.putString("3_3",desa_f3_ans_3.getText().toString().trim());
		editor.putString("3_4",desa_f3_ans_4.getText().toString().trim());
		editor.putString("3_5a",desa_f3_ans_5a.getText().toString().trim());
		editor.putString("3_5b",desa_f3_ans_5b.getText().toString().trim());
		editor.putString("3_5c",desa_f3_ans_5c.getText().toString().trim());
		editor.putString("3_5d",desa_f3_ans_5d.getText().toString().trim());
		editor.putString("3_5e",desa_f3_ans_5e.getText().toString().trim());
		editor.commit();
	}

	@Override
	protected void onResume() {
		// TODO Auto-generated method stub
		super.onResume();
		SharedPreferences preferences=getSharedPreferences("desa_f3_details", MODE_PRIVATE);
		desa_f3_ans_1a.setText(preferences.getString("3_1a",""));
		desa_f3_ans_1b.setText(preferences.getString("3_1b",""));
		desa_f3_ans_211.setText(preferences.getString("3_211",""));
		desa_f3_ans_212.setText(preferences.getString("3_212",""));
		desa_f3_ans_213.setText(preferences.getString("3_213",""));
		desa_f3_ans_214.setText(preferences.getString("3_214",""));
		desa_f3_ans_215.setText(preferences.getString("3_215",""));
		desa_f3_ans_221.setText(preferences.getString("3_221",""));
		desa_f3_ans_222.setText(preferences.getString("3_222",""));
		desa_f3_ans_223.setText(preferences.getString("3_223",""));
		desa_f3_ans_224.setText(preferences.getString("3_224",""));
		desa_f3_ans_225.setText(preferences.getString("3_225",""));
		desa_f3_ans_231.setText(preferences.getString("3_231",""));
		desa_f3_ans_232.setText(preferences.getString("3_232",""));
		desa_f3_ans_233.setText(preferences.getString("3_233",""));
		desa_f3_ans_234.setText(preferences.getString("3_234",""));
		desa_f3_ans_235.setText(preferences.getString("3_235",""));
		desa_f3_ans_3.setText(preferences.getString("3_3",""));
		desa_f3_ans_4.setText(preferences.getString("3_4",""));
		desa_f3_ans_5a.setText(preferences.getString("3_5a",""));
		desa_f3_ans_5b.setText(preferences.getString("3_5b",""));
		desa_f3_ans_5c.setText(preferences.getString("3_5c",""));
		desa_f3_ans_5d.setText(preferences.getString("3_5d",""));
		desa_f3_ans_5e.setText(preferences.getString("3_5e",""));
	}
	
}
